package com.xiexie.order.config;

import com.xiexie.order.interceptor.feign.CustomFeignInterceptor;
import feign.Contract;
import feign.Logger;
import feign.Request;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Description OpenFeign配置类
 * <p>
 * 全局配置：当使用@Configuration，会将配置作用于所有的服务提供方
 * 局部配置：如果只想针对某一个或某些服务进行配置，就不需要加@Configuration注解
 * @Date 2022-04-11 14:44
 * @Author xie
 */
@Configuration
public class FeignConfig {

    @Bean
    public Logger.Level feignLoggerLevel() {
        return Logger.Level.FULL;
    }

    /**
     * 修改契约配置，支持Feign原生的注解
     *
     * @return feign.Contract
     */
    //@Bean
    //public Contract feignContract() {
    //    return new feign.Contract.Default();
    //}

    /**
     * 设置超时时间
     * @return feign.Request.Options
     */
    //@Bean
    //public Request.Options options() {
    //    return new Request.Options(5000, 10000);
    //}

    /**
     * 自定义拦截器
     * @return com.xiexie.order.interceptor.feign.CustomFeignInterceptor
     */
    //@Bean
    //public CustomFeignInterceptor customFeignInterceptor() {
    //    return new CustomFeignInterceptor();
    //}

}
